import request from '@/utils/request'
import qs  from 'qs'

// 查询合同信息列表
export function listContract(query) {
  return request({
    url: '/itemmanage/contract/list',
    method: 'get',
    params: query
  })
}

// 查询合同信息详细
export function getContract(id) {
  return request({
    url: '/itemmanage/contract/' + id,
    method: 'get'
  })
}

// 新增合同信息
export function addContract(data) {
  return request({
    url: '/itemmanage/contract',
    method: 'post',
    data: data
  })
}

// 修改合同信息
export function updateContract(data) {
  return request({
    url: '/itemmanage/contract',
    method: 'put',
    data: data
  })
}

// 确认通过
export function pass(params) {
  let formParams = qs.stringify(params);
  return request({
    url: '/itemmanage/contract/pass',
    data: formParams,
    headers: {'content-type': 'application/x-www-form-urlencoded'}, // 表单参数
    method: 'put'
  })
}

// 确认盖章
export function stamp(params) {
  let formParams = qs.stringify(params);
  return request({
    url: '/itemmanage/contract/stamp',
    data: formParams,
    headers: {'content-type': 'application/x-www-form-urlencoded'}, // 表单参数
    method: 'put'
  })
}

// 确认不通过
export function unPass(params) {
  let formParams = qs.stringify(params);
  return request({
    url: '/itemmanage/contract/unPass',
    data: formParams,
    headers: {'content-type': 'application/x-www-form-urlencoded'}, // 表单参数
    method: 'put'
  })
}
// 作废
export function invalid(params) {
  let formParams = qs.stringify(params);
  return request({
    url: '/itemmanage/contract/invalid',
    data: formParams,
    headers: {'content-type': 'application/x-www-form-urlencoded'}, // 表单参数
    method: 'put'
  })
}

// 删除合同信息
export function delContract(id) {
  return request({
    url: '/itemmanage/contract/' + id,
    method: 'delete'
  })
}
